<template>
    <div class="mod-config">
    <basic-container>
      <div class="avue-crud">
        <el-table :data="dataList" stripe tooltip-effect="light" ref="tableRef">
            <el-table-column type="selection" width="55" header-align="center" align="center"></el-table-column>
            <el-table-column prop="taskName" label="任务名称" min-width="150">
            </el-table-column>
            <el-table-column prop="weightset" label="权重设置" min-width="150">
            </el-table-column>
            <el-table-column prop="departName" label="数据提供部门" min-width="150">
            </el-table-column>
        </el-table>
    </div>
    </basic-container>
  </div>
</template>
<script>
  import {getRenwuzhibiaokuList} from '@/api/hetongrenwu/zhongdian/renwuchuangjian'

    export default {
        data() {
            return {
                dataList: [],
                pageIndex: 1,
                pageSize: 10,
                totalPage: 0,
            }
        },
        props:{
            hetongId: Number,
        },
        methods: {
            // 获取数据列表
            getDataList() {
              getRenwuzhibiaokuList().then(response => {
                    this.dataList = response.data.data
                })
            },
            // 每页数
            sizeChangeHandle(val) {
                this.pageSize = val
                this.pageIndex = 1
                this.getDataList()
            },
            // 当前页
            currentChangeHandle(val) {
                this.pageIndex = val
                this.getDataList()
            },
            saveZhibiao(k){
                const rows = this.$refs.tableRef.selection
                if(rows.length < 1){
                    this.$message({
                            type: 'info',
                            message: '请选择指标添加'
                        });  
                }else{
                  if(k==1){
                    if(rows.length > 1){
                      this.$message({
                        type: 'info',
                        message: '请选择一个指标添加'
                      });
                    }else{
                      this.$emit('func',rows)
                    }
                  }else{
                    this.$emit('func',rows)
                  }
                }
            }
        }
    }
</script>
